package com.smartthinking.dive;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class MapaAnunciantes extends android.support.v4.app.FragmentActivity{

	private GoogleMap mapa = null;
	String poi_lat, poi_lng;
	Button home;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.mapaanunciante);
		home= (Button) findViewById(R.id.btnHOME);
		
		home.setOnClickListener(new View.OnClickListener() {
			public void onClick(View arg0)
			{
				finish();
				Intent intent1 = new Intent(MapaAnunciantes.this,Principal.class);
				intent1.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(intent1);
			}
		});
		
		Bundle extras1 = getIntent().getExtras();
		poi_lat = extras1.getString("query17");
		poi_lng = extras1.getString("query18");

		mapa = ((SupportMapFragment) getSupportFragmentManager()
				.findFragmentById(R.id.map)).getMap();

		if (mapa != null) 
		{
			//	  mapa.addMarker(new MarkerOptions().position(new LatLng(19.43554, -99.18849)));
			//	  
			//	  mapa.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(19.43554, -99.18849), 15));

			mapa.addMarker(new MarkerOptions().position(new LatLng(Double.parseDouble(poi_lat),Double.parseDouble(poi_lng))));

			mapa.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(Double.parseDouble(poi_lat),Double.parseDouble(poi_lng)), 15));

		}


	}



}
